#include<stdio.h>
#include<stdlib.h>

#define MAXNUM 10
#define ELEMTYPE2 char
typedef struct{
	ELEMTYPE2 stack[ MAXNUM ];
	int top;
}QStype2;

void initiateQStack2( QStype2 *s ){
	s->top = -1;
}

int pushQStack2( QStype2 *s, ELEMTYPE2 c ){
	if( s->top >= MAXNUM - 1 )
		return 0;
	else{
		s->stack[ ++(s->top) ] = c;
		return 1;
	}
}

int popQStack2( QStype2 *s, ELEMTYPE2 *p ){
	if( s->top == -1 )
		return 0;
	*p =  s->stack[ (s->top)-- ];
	return 1;
}

int isEmpty2( QStype2 *s ){
	if( s->top == -1 )
		return 1;
	return 0;
}

ELEMTYPE2 getTopElem2( QStype2 *s ){
	if( isEmpty( s ) )
		return NULL;
	return s->stack[ s->top ];
}
